import datetime
from pydantic import BaseModel, HttpUrl, Field

# Base schema for gallery item attributes
class GalleryItemBase(BaseModel):
    image_url: HttpUrl # Use HttpUrl for validation
    prompt: str = Field(..., max_length=1000)
    category: str = Field(..., description="e.g., 风景, 人物, 抽象, 其他")

# Schema for creating a gallery item (used by admin)
class GalleryItemCreate(GalleryItemBase):
    pass # No extra fields needed for creation besides base

# Schema for reading gallery item data
class GalleryItem(GalleryItemBase):
    id: int
    uploaded_by: int # ID of the admin user who uploaded
    created_at: datetime.datetime

    class Config:
        from_attributes = True 